clear; clc; close all;
% 绘制 MNFM1 映射对参数 b 的LEs指数图
%
%   a = 0.02, c = 1.1, d = 0.001
%   b 从 2.35 扫描到 2.65

% 固定的模型参数
a = 0.02;
c = 1.1;
d = 0.001;
func = @f1;

bStart = 2.35;
bEnd   = 2.65;
bStep  = 0.001;
bVals = bStart : bStep : bEnd;

N = 5000;         % 总迭代步数
discard = 1000;   % 丢弃暂态步数

% 初始条件
x0 = 1.0;
y0 = 2.0;

LE1_array = zeros(size(bVals));
LE2_array = zeros(size(bVals));

% 调用 LEs 逐个计算 (LE1, LE2)
for i = 1:length(bVals)
    b = bVals(i);
    [LE1, LE2] = LEs(func, a, b, c, d, x0, y0, N, discard);
    LE1_array(i) = LE1;
    LE2_array(i) = LE2;
end

figure('Color','w');
plot(bVals, LE1_array, 'r-', 'LineWidth',1.2); hold on;
plot(bVals, LE2_array, 'b-', 'LineWidth',1.2);
yline(0, '--k', 'LineWidth', 1);
xlabel('$b$', 'Interpreter','latex','FontSize',14);
ylabel('Lyapunov Exponents', 'Interpreter','latex','FontSize',14);
title('MNFM1: Two Lyapunov Exponents vs. $b$', 'Interpreter','latex','FontSize',16);
legend({'$\lambda_1$','$\lambda_2$'}, 'Interpreter','latex','FontSize',12, 'Location','best');
set(gca, 'FontName','Times New Roman', 'FontSize',12);
grid on; box on; axis tight;

% exportgraphics(gcf, 'mnfm1_2LEs_vs_b.png', 'Resolution',300);
